package com.hx.vending.dao;

import com.hx.vending.bean.Customer;
import com.hx.vending.bean.Region;
import com.hx.vending.bean.SubAccount;
import com.hx.vending.bean.User;
import com.hx.vending.bean.entity.*;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;
import org.springframework.web.bind.annotation.PathVariable;

import java.util.List;
import java.util.Map;

/**
 * Created by Administrator on 2018/11/27.
 */
@Repository
public interface UserMapper {

    User selectByPrimary(@Param("userPhone") String userPhone);

    User findByUserPhone(@Param("userPhone") String userPhone);

    int insertByPhone(User user);

    User selectByPrimaryKey(User user);

    int updatePassword(@Param("userPhone") String userPhone,@Param("userPassWord") String userPassWord);

    int updateByPrimaryKeySelective(User user);

    List<User> selectByExample(User user);

    List<RegionVo> selectRegionOne();

    List<RegionDetailVo> selectRegionVoByPid(Integer regionPid);

    List<Region> selectRegionByPid(Integer regionPid);

    UserService selectUserServiceById(Integer userId);

    int deleteByPrimaryKey(Integer userId);

    User selectUserById(Integer userId);

    UserVO selectBankByUserId(Integer userId);

    List<UserAudit> selectUserBankList(@Param("userName") String userName, @Param("state") String state,
                                       @Param("startTime") String startTime, @Param("endTime") String endTime,
                                       @Param("pageStart") Integer pageStart);

    List<User> selectUserBack(Map<String,Object> map);

    Integer selectUserNum(@Param("userName") String userName,@Param("userPhone") String userPhone);
    
    /**
     * 将priviewcustomerId设为空
     * @param user
     * @return
     */
    int updateCustomerIdNull(User user);

    int updateSecondaryPassword(@Param("userPhone") String userPhone,@Param("userPassWord") String userPassWord);

    int deleteBatchByList(@Param("integerList") List<Integer> integerList);

    List<SubAccount> selectUserByUserId(@Param("userId") Integer userId,@Param("userName") String userName);

    List<User> selectByRoleId(@Param("roleId") Integer roleId);

    List<User> selectByRoleIds(@Param("roleIds") String[] roleIds);

    SubAccount selectDetailsByUserId(@Param("account") Integer account);

    int updateSubAccount(@Param("userId") Integer userId,@Param("userName") String userName,
                         @Param("userPassWord") String userPassWord,@Param("userPhone") String userPhone,
                         @Param("roleId") String roleId,@Param("fieldId") String fieldId);

    int updateSubAccountUse(@Param("account") Integer account,@Param("subsidiaryUse") Integer subsidiaryUse);

    User selectUserDetailsById(@Param("userId") Integer userId);
}
